package org.boyan.modules.cgform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.boyan.modules.cgform.entity.OnlCgformButton;
import org.boyan.modules.cgform.mapper.OnlCgformButtonMapper;
import org.boyan.modules.cgform.service.IOnlCgformButtonService;
import org.springframework.stereotype.Service;

/**
 * @author: zhuxiaobao
 * @time: 2021/9/26 12:31
 */

@Service("onlCgformButtonServiceImpl")
public class b extends ServiceImpl<OnlCgformButtonMapper, OnlCgformButton> implements IOnlCgformButtonService {
    public void saveButton(OnlCgformButton onlCgformButton) {
        LambdaQueryWrapper<OnlCgformButton> lambdaQueryWrapper = new LambdaQueryWrapper<OnlCgformButton>()
                .eq(OnlCgformButton::getButtonCode, onlCgformButton.getButtonCode())
                .eq(OnlCgformButton::getCgformHeadId, onlCgformButton.getCgformHeadId());
        Integer integer = this.baseMapper.selectCount(lambdaQueryWrapper);
        if (integer == null || integer == 0)
            save(onlCgformButton);
    }
}
